import { Form, Input } from 'antd';

const ApiForm = ({ form, isEditing }) => {
  return (
    <Form form={form} layout="vertical">
      {isEditing ? (
        <>
          <Form.Item name="permissionId" label="权限ID" hidden>
            <Input />
          </Form.Item>
          <Form.Item name="label" label="权限名称">
            <Input disabled />
          </Form.Item>
          <Form.Item name="code" label="授权标识符">
            <Input disabled />
          </Form.Item>
        </>
      ) : (
        <>
          <Form.Item 
            name="label" 
            label="权限名称" 
            rules={[{ required: true, message: '请输入权限名称' }]}
          >
            <Input placeholder="请输入权限名称" />
          </Form.Item>
          <Form.Item 
            name="code" 
            label="授权标识符" 
            rules={[{ required: true, message: '请输入授权标识符' }]}
          >
            <Input placeholder="请输入授权标识符" />
          </Form.Item>
        </>
      )}
      <Form.Item name="remark" label="备注">
        <Input.TextArea placeholder="请输入备注" rows={4} />
      </Form.Item>
    </Form>
  );
};

export default ApiForm;